import { IPSDELogic } from '../../dataentity/logic/ipsdelogic';
import { IPSModelObject } from '../../ipsmodel-object';
import { PSModelServiceProxyImpl } from '../../psmodel-service-proxy-impl';

/**
 * 全局默认通用代理
 *
 * @author chitanda
 * @date 2021-06-08 20:06:55
 * @export
 * @class PSDELogicServiceProxy
 * @extends {PSModelServiceProxyImpl}
 */
export class PSDELogicServiceProxy extends PSModelServiceProxyImpl {
  getPSModel4(
    relatedPSModelObject: IPSModelObject,
    cls: string,
    objNode: any,
    strTag: string,
  ): IPSModelObject {
    switch (strTag) {
      case 'getStartPSDELogicNode':
        return this.getStartPSDELogicNode(
          relatedPSModelObject as IPSDELogic,
          objNode,
        );
    }
    return this.getRealPSModelService().getPSModel4(
      relatedPSModelObject,
      cls,
      objNode,
      strTag,
    );
  }

  getStartPSDELogicNode(relatedPSModelObject: IPSDELogic, obj: any): any {
    if (obj.modelref) {
      return relatedPSModelObject.findPSDELogicNode(obj);
    }
    return null;
  }
}
